<?php

namespace app\model;


use think\Model;
class CarouselModel extends Model {
    protected $pk = 'id';

    protected $table = 'carousel';

    protected $autoWriteTimestamp = true;
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    // 状态转换（可选）
    public function getTypeTextAttr($value, $data)
    {
        return $data['type'] === 0 ? '图片' : '视频';
    }

    public function getIsDisplayTextAttr($value, $data)
    {
        return $data['is_display'] === 1 ? '显示' : '隐藏';
    }
}



